package demo.pattern.factory.simple;

import demo.pattern.entity.DellMouse;
import demo.pattern.entity.HpMouse;
import demo.pattern.entity.Mouse;

/**
 * @author 折戟沉沙铁未销
 * @version V1.0
 * @date 2020/7/7-2020
 * @Description: 简单工厂
 */
public class MouseFactory {

    /**
     * 简单工厂方法，根据不同的type类型返回不同的鼠标
     * @param type
     * @return
     */
    public static Mouse createMouse(int type){
        switch (type){
            case 1:return new HpMouse();
            default:return new DellMouse();
        }
    }
}
